Use the retry decorator in WiFi tests (Bugfix)#1488
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1488 +/- ##
==========================================
+ Coverage 47.48% 47.50% +0.01%
==========================================
Files 369 369
Lines 39586 39549 -37
Branches 6685 6678 -7
==========================================
- Hits 18798 18788 -10
+ Misses 20077 20050 -27
Partials 711 711
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This helps investigating issues when more than one functions are using the retry decorator.
Both function are doing exactly the same thing, the only difference being the command used. Create a connection() function, and call it from open_connection() and secured_connection(). Compared to the previous implementation, the connection() function is more linear and does not rely on boolean return codes to decide what to do. Instead, it's trying to do things and expect exceptions to be raised in case of problem (this is why it's using subprocess.run(..., check=True) for instance)
Parts of the wifi_nmcli_test.py script was implementing a basic retry mechanism. Remove this to use the retry decorator instead. In addition, raise exceptions rather than trying to catching them, or using boolean return codes.
This is to avoid waiting for the actual retry decorator implementation.
1519956 to
3f52db9
Compare
Collaborator
|
Testing this on 3 devices in the lab (focal, jammy, noble): https://github.com/canonical/checkbox/actions/runs/10958861773 For reference, here is the command: |
Hook25
previously approved these changes
Sep 23, 2024
Collaborator
Hook25
left a comment
There was a problem hiding this comment.
LGTM +1, consider a few small changes here and there
Co-authored-by: Massimiliano <massimiliano.girardi@canonical.com>
Co-authored-by: Massimiliano <massimiliano.girardi@canonical.com>
Hook25
approved these changes
Sep 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The main raisons d'être of this PR are:
wifi_nmcli_test.pyscript. This is done to prevent an often seen failure in the lab where the usual answer is to rerun the whole test plan. Now, the WiFi test retries up to 5 times, adding a delay between each retry.Resolved issues
CHECKBOX-1543
Documentation
Nothing is modified in terms of Checkbox jobs or external-facing documentation.
Tests